<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>

<%--<!DOCTYPE html>--%>
<%--<html>--%>

<%--<head>--%>
<%--	<meta charset="UTF-8">--%>
<%--	<meta name="renderer" content="webkit">--%>
<%--	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">--%>
<%--	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />--%>
<%--	<title>个人中心-我的订单</title>--%>
<%--	<!-- Favicon -->--%>
<%--	<link rel="shortcut icon" href="/boot/llr/images/favicon.ico"/>--%>
<%--	<link rel="stylesheet" href="/boot/llr/css/backend-plugin.min.css">--%>
<%--	<link rel="stylesheet" href="/boot/llr/css/backend.css?v=1.0.0">--%>
<%--	<link rel="stylesheet" href="/boot/llr/vendor/@fortawesome/fontawesome-free/css/all.min.css">--%>
<%--	<link rel="stylesheet" href="/boot/llr/vendor/line-awesome/dist/line-awesome/css/line-awesome.min.css">--%>
<%--	<link rel="stylesheet" href="/boot/llr/vendor/remixicon/fonts/remixicon.css">--%>
<%--	<link rel="stylesheet" href="/boot/llr/layui-v2.6.5/layui/css/layui.css">--%>
<%--&lt;%&ndash;	<link rel="stylesheet" href="/boot/llr/layui-v2.6.5/layui/css/layui.css">&ndash;%&gt;--%>
<%--</head>--%>

<%--<body>--%>
<div class="page-content-wrap">
	<form class="layui-form" action="">
		<p style="font-size: 20px;margin-bottom: 20px">我的订单</p>
	</form>
	<div class="layui-form" id="table-list">
		<table class="layui-table" lay-even lay-skin="nob">
<%--			<colgroup>--%>
<%--				<col width="50">--%>
<%--				<col class="hidden-xs" width="50">--%>
<%--				<col class="hidden-xs" width="100">--%>
<%--				<col>--%>
<%--				<col class="hidden-xs" width="200">--%>
<%--				<col width="80">--%>
<%--				<col width="150">--%>
<%--			</colgroup>--%>
<%--			<thead>--%>
			<tr>
<%--				<th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>--%>
<%--				<th style="width: 70px">用户姓名</th>--%>
				<th>订单编号</th>
				<th>车辆品牌</th>
				<th>车辆型号</th>
				<th>汽车价格</th>
				<th style="width: 120px">创建时间</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			<c:forEach items="${ordersList}" var="c">
				<tr>
<%--					<td><input type="checkbox" name="" lay-skin="primary" data-id="1"></td>--%>
					<td>${c.ordersNo}</td>

					<td>
						<c:forEach items="${ordersDetailsList}" var="o">
							<c:forEach items="${brandsList}" var="b">
								<c:if test="${c.id == o.ordersId && o.carId == b.id}">${b.brName}</c:if>
							</c:forEach>
						</c:forEach>
					</td>

					<td>
						<c:forEach items="${ordersDetailsList}" var="o">
							<c:forEach items="${stylesList}" var="s">
								<c:if test="${c.id == o.ordersId && o.carName == s.id}">${s.stName}</c:if>
							</c:forEach>
						</c:forEach>
					</td>

					<td>${c.price}</td>

					<td>
						<fmt:formatDate value="${c.createDate}" pattern="yyyy-MM-dd "/>
					</td>

					<td>
						<c:if test="${c.status == 0}">
						<button class="layui-btn layui-btn-mini layui-btn-normal table-list-status" data-status='1'>未支付</button>
						</c:if>
						<c:if test="${c.status == 1}">
							<button class="layui-btn layui-btn-mini layui-btn-normal table-list-status" data-status='1'>已支付</button>
						</c:if>
					</td>

					<td>
<%--						<div class="layui-inline">--%>
<%--							<a class="badge bg-warning mr-2" data-toggle="tooltip" data-placement="top"--%>
<%--							   title="" data-original-title="Delete" onclick="deleteOrx(this,${c.id})"--%>
<%--							   id="deleteOrder"><i class="ri-delete-bin-line mr-0">删除</i></a>--%>
<%--						</div>--%>
						<div class="layui-inline">
							<button class="layui-btn layui-btn-mini layui-btn-danger del-btn" data-id="1"
									data-url="del.html"onclick="deleteOrx(this,${c.id})"
									id="deleteOrder"><i class="layui-icon">删除</i></button>
						</div>
					</td>

				</tr>
			</c:forEach>
			</tbody>
		</table>
<%--		<div class="page-wrap">--%>
<%--			<ul class="pagination">--%>
<%--				<li class="disabled"><span>«</span></li>--%>
<%--				<li class="active"><span>1</span></li>--%>
<%--				<li>--%>
<%--					<a href="#">2</a>--%>
<%--				</li>--%>
<%--				<li>--%>
<%--					<a href="#">»</a>--%>
<%--				</li>--%>
<%--			</ul>--%>
<%--		</div>--%>
	</div>
</div>
<!-- Backend Bundle JavaScript -->
<script src="/boot/js/jquery.js"></script>
<script>
	function deleteOrx(obj,id) {

          // alert("111111111");

		layui.use(['layer'], function () {
			let layer = layui.layer;

			layer.confirm('您确定要删除订单吗?', {icon: 3, title: '提示'}, function (index) {
				$.get('/boot/user/deleteOrders', {"id": id}, function (data) {
					if (data.code == "200") {
						//js操作dom - 把tr标签从tbody标签删除
						$(obj).parent().parent().parent().remove();

						layer.msg('删除成功', {icon: 6});

					} else {
						layer.msg("删除失败!");
					}
				});

				layer.close(index);
			});
		});
	}
</script>

<%--</body>--%>

<%--</html>--%>